/**
 * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
 *
 * 
 * @param str string字符串 
 * @return string字符串
 */
function filterMaxStr (str) {
  // write code here
  let left = 0
  let right = 0
  let start = 0
  let len = 0
  let window = []
  while (right < str.length) {
    let c = str[right]
    if (!window.includes(c)) {
      right++
      window.push(c)
    } else {
      if (right - left > len) {
        start = left
        len = right - left
        while (window[0] !== c) {
          window.shift()
          left++
        }
        window.shift()
        left++
      }
      right++
    }
  }
  if (right - left > len) {
    start = left
    len = right - left
  }
  return str.slice(start, start + len)
}